home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Utilities Experience
/
The Utilities Experience - Volume 1.iso
/
software
/
comms
/
mosiac
/
mosaic_1.2_as225r2
/
contrib
/
mshunt
/
mosaic_shunt.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1978-06-29
|
4KB
|
120 lines
/*Shunt for Amiga Mosaic, takes filename from .mailcap file and sends it*/
/*off to a user-definable viewer. After viewing,*/
/*or failing to view, the program offers up a file requestor for the user*/
/*to choose a location to save the file, or one can cancel to avoid saving*/
/*(c) 1994 Aaron Weiss - Improveware - Improve it as you wish, since this*/
/*is my first AREXX program and I'm sure it can be a whole hell of a lot*/
/*better! */
/*---------------------------------------------------------------------------*/
/*User definable variables */
savemode=2 /*1=Never Save, 2=Option w/Reqestor, 3=Always save, no req. */
savedrawer='temp:pix' /*Set this string to the default drawer for saving */
/*although you can change this in the file req. */
/*Set these to the commandline to launch the particular viewer/player */
/*Include all parameters that you normally would, and use %s in the place */
/*of where the filename to view/play should go. Note that you CAN use */
/*the %s in multiple places in one line, should you want to. */
jpegviewer='graphics:pfastjpeg %s'
gifviewer='graphics:vt/vt screenmode="super72:super-high res laced" %s'
iffviewer='graphics:vt/vt screenmode="super72:super-high res laced" %s'
animviewer='graphics:vt/vt screenmode="super72:super-high res laced" %s'
playiff='sound:oplay %s'
playau='sound:oplay %s'
/*---------------------------------------------------------------------------*/
/*That's it, no more user definable variables. Suffer.*/
/*Venture below this point at your own risk!*/
Infile=ARG(1)
/*Let's figure out what type of file this momma jomma is*/
FileName=Infile
filehead=''
if open(.IFile, FileName, 'R') then do
filehead = filehead || (READCH(.IFile,40))
close (FileName)
end
SELECT
When INDEX(filehead,"GIF") > 0 then viewer=gifviewer
When INDEX(filehead,"JFIF") > 0 then viewer=jpegviewer
When INDEX(filehead,"ILBM") > 0 then viewer=iffviewer
When INDEX(filehead,"ANIM") > 0 then viewer=animviewer
When INDEX(filehead,"8SVX") > 0 then viewer=playiff
When INDEX(filehead,"snd") > 0 then viewer=playau
OTHERWISE viewer='none'
END
/*Onto the show*/
/*First we need to create the commandline with filename in place of %s*/
filepos=1
DO UNTIL filepos=0
filepos=INDEX(viewer,"%s")
If filepos>0 Then
DO
cmd1=LEFT(viewer,(filepos-1))
cmd2=RIGHT(viewer,LENGTH(viewer)-(filepos+1))
viewer=cmd1||Infile||cmd2
END
END
/*Now create a little scriptfile to execute the command*/
ADDRESS command
conwindow=">CON:0/0/320/100/Mosaic Shunt Message/Close"
CALL OPEN out, "t:rexx.tmp",write
CALL WRITELN out, viewer
CALL CLOSE out
if viewer~='none' Then 'execute' "t:rexx.tmp"
Else 'echo "Could not identify file type!" >con:0/100/255/20/Shunt_Message/CLOSE/WAIT'
/*And in the following mess we go about preparing to save the file, or not, */
/*depending on the user setting at the top of this file*/
If savemode>1 Then
DO
SaveFile=Infile
Mark=LASTPOS("/",SaveFile)
If Mark==0 Then
Mark=LASTPOS(":",SaveFile)
If Mark>0 Then
SaveFile=Right(SaveFile,LENGTH(SaveFile)-Mark)
If savemode=2 Then
DO
'requestfile DRAWER' savedrawer 'FILE' SaveFile 'TITLE "Save This Baby Where?" > t:savefile'
If rc~=0 Then DO
'echo "Save cancelled" >con:0/100/250/20/Shunt_Message/CLOSE/WAIT'
exit
END
ELSE DO
FileName='t:savefile'
SaveFile=''
if open(IFile, FileName, 'R') then do
do until eof(IFile)
SaveFile = SaveFile || (READLN(IFile))
end
end
END
END
ELSE SaveFile=savedrawer ||'/'||SaveFile
/*After all the above rigamarole, we've either got a filename to save to by now, */
/*or else we've dropped out some time ago. So save it, McCloud. */
'copy ' Infile Savefile
END
/*Yay! Let Mosaic have you back again. It misses you.*/
exit